home *** CD-ROM | disk | FTP | other *** search
/ Light ROM 4 / Light ROM 4 - Disc 1.iso / text / maillist / 1994 / aug94.doc / 000477_owner-lightwave-l _Tue Aug 23 17:30:09 1994.msg < prev    next >
Internet Message Format  |  1995-03-23  |  18KB

  1. Return-Path: <owner-lightwave-l>
  2. Received: by mail3.netcom.com (8.6.9/Netcom)     id PAA10901; Tue, 23 Aug 1994 15:55:32 -0700
  3. Received: from gwha.com by mail3.netcom.com (8.6.9/Netcom)     id PAA10827; Tue, 23 Aug 1994 15:54:58 -0700
  4. Received: from kong.gwha.com (kong.gwha.com [192.231.139.38]) by gwha.com (8.6.5/8.6.5) with SMTP id WAA15461 for <@gwha.com:lightwave-l@netcom.com>; Tue, 23 Aug 1994 22:14:33 GMT
  5. Received: by kong.gwha.com (931110.SGI/930416.SGI.AUTO)     for @gwha.com:lightwave-l@netcom.com id AA01375; Tue, 23 Aug 94 16:14:31 -0600
  6. From: "Chris Hurtt" <chris@kong.gwha.com>
  7. Message-Id: <9408231614.ZM1373@kong.gwha.com>
  8. Date: Tue, 23 Aug 1994 16:14:28 -0600
  9. X-Mailer: Z-Mail (3.1.0 22feb94 MediaMail)
  10. To: lightwave-l@netcom.com
  11. Subject: LW Object File Format
  12. Content-Type: text/plain; charset=us-ascii
  13. Mime-Version: 1.0
  14. Sender: owner-lightwave-l@netcom.com
  15. Precedence: bulk
  16. Reply-To: lightwave-l@netcom.com
  17.  
  18.  
  19. A little later than planned but as promised:
  20.  
  21.                    LIGHTWAVE 3D OBJECT FILE FORMAT
  22.  
  23.                           by Allen Hastings
  24.                           revised  11/10/93
  25.  
  26.  
  27. Introduction
  28.  
  29.   LightWave 3D objects are stored as IFF files with a FORM type of
  30.   LWOB.  Currently, a FORM LWOB must contain a PNTS chunk, a SRFS
  31.   chunk, and a POLS chunk (in that order).  These may be followed by
  32.   zero or more SURF chunks.  LightWave 2.0 also has the ability to
  33.   save and load surface descriptions as FORM LWOB files that contain
  34.   only a SURF chunk.
  35.  
  36.   This document explains the contents of each chunk and includes an
  37.   annotated listing of a FORM LWOB as an example.
  38.  
  39.  
  40. PNTS Chunk
  41.  
  42.   This chunk contains a list of the X, Y, and Z coordinates of all
  43.   the points in an object.  Each coordinate is stored as a four byte
  44.   floating point number in IEEE format.  Therefore, the number of
  45.   points in an object can be determined by dividing the size in bytes
  46.   of the PNTS chunk by 12.
  47.  
  48.   By convention, the +X direction is to the right or east, the +Y
  49.   direction is upward, and the +Z direction is forward or north.
  50.   For models of real-world objects, the unit size is usually
  51.   considered to be one meter.  The coordinates are specified relative
  52.   to an object's pivot point.  See the LightWave Modeler manual for
  53.   more information about LightWave 3D's geometric conventions.
  54.  
  55.  
  56. SRFS Chunk
  57.  
  58.   This chunk contains a list of the names of all the surfaces in an
  59.   object (note that in LightWave 3D terminology, the word "surface"
  60.   is defined as a set of attributes that describe the color and
  61.   shading characteristics of a group of polygons).  Each surface name
  62.   appears as a null-terminated character string.  If the length of
  63.   the string (including the null) is odd, an extra null byte is
  64.   added.  Surface names should be read from the file until as many
  65.   bytes as the chunk size specifies have been read.
  66.  
  67.  
  68. POLS Chunk
  69.  
  70.   This chunk contains a list of all the polygons in an object.  Each
  71.   entry consists of a short integer specifying the number of vertices
  72.   in a polygon followed by that many short integers specifying the
  73.   vertices themselves (as indices into the points list) followed by a
  74.   short integer specifying which surface is used by the polygon (as
  75.   an index into the surfaces list).  The number of vertices in a
  76.   polygon currently may vary from one to 200.  The vertex list for
  77.   each polygon should begin at a convex vertex and proceed clockwise
  78.   as seen from the visible side of the polygon (LightWave 3D polygons
  79.   are single-sided, except for those whose surfaces have the double-
  80.   sided flag set).  The points list in the PNTS chunk is numbered
  81.   starting with zero and the surfaces list in the SRFS chunk is
  82.   numbered starting with one (so that surface numbers can be made
  83.   negative to signal the presence of detail polygons as explained
  84.   below).  Polygons should be read from the file until as many bytes
  85.   as the chunk size specifies have been read.
  86.  
  87.   A negative surface number for a polygon indicates that the polygon
  88.   has detail polygons (which are drawn on top of the main polygon and
  89.   may be coplanar with it).  In this case, the next number in the
  90.   file is a short integer specifying how many detail polygons belong
  91.   to the current polygon.  This is followed by a list of those detail
  92.   polygons, where each entry is of the same format as described above
  93.   for regular polygons (except that the detail polygons cannot have
  94.   details of their own).  The list of regular polygons then resumes.
  95.   To determine which surface is used by a polygon with a negative
  96.   surface number, the absolute value of that number should be used.
  97.  
  98.  
  99. SURF Chunks
  100.  
  101.   Each SURF chunk describes the surface attributes of a particular
  102.   surface.  These chunks begin with the name of the surface being
  103.   described.  The name is stored as a character string with either
  104.   one or two trailing nulls (as explained in the SRFS chunk section).
  105.   Following the name is a series of sub-chunks, which are like normal
  106.   IFF chunks except that their sizes are specified by short integers
  107.   instead of longs.  It is likely that the variety of sub-chunks will
  108.   grow as new surface attributes are added to the program, but any
  109.   unknown sub-chunks may be skipped over in the usual IFF fashion.
  110.   Sub-chunks should be read from the file until as many bytes as the
  111.   chunk size specifies have been read.
  112.  
  113.   COLR Sub-Chunk
  114.  
  115.     This sub-chunk consists of three bytes that specify the red,
  116.     green, and blue color components of the current surface, followed
  117.     by a byte which is currently ignored and should be zero.  A
  118.     surface can therefore be any of 16,777,216 possible colors.
  119.  
  120.   FLAG Sub-Chunk
  121.  
  122.     This sub-chunk contains a short integer whose bits specify
  123.     various options for the current surface.  Currently only the
  124.     nine least significant bits are used.  The options that set bits
  125.     indicate are (starting with the least significant bit):
  126.     Luminous, Outline, Smoothing, Color Highlights, Color Filter,
  127.     Opaque Edge, Transparent Edge, Sharp Terminator, Double Sided,
  128.     and Additive (which is new for LW 3.0).  Note that the two edge
  129.     transparency bits should not both be set.
  130.  
  131.   LUMI, DIFF, SPEC, REFL, and TRAN Sub-Chunks
  132.  
  133.     Each of these sub-chunks contain a short integer that specifies
  134.     the current surface's luminosity, diffuse, specular, reflection,
  135.     or transparency settings (the LUMI sub-chunk is new for LW 3.0,
  136.     and replaces the Luminous bit of the FLAG sub-chunk).  A value of
  137.     256 in the file corresponds to a setting of 100% on the control
  138.     panel.  If any of these sub-chunks are absent for a surface, a
  139.     value of zero is assumed for the corresponding parameter.
  140.  
  141.   GLOS Sub-Chunk
  142.  
  143.     This sub-chunk contains a short integer that specifies the
  144.     glossiness of the current surface, and is only needed if the
  145.     specular setting in the SPEC sub-chunk is non-zero.  A value of
  146.     16 indicates low glossiness, 64 indicates medium glossiness, 256
  147.     indicates high glossiness, and 1024 indicates maximum glossiness
  148.     (the maximum setting is new for LW 3.0).  This parameter is
  149.     related to the "specular exponent" used in many lighting models.
  150.  
  151.   RIMG Sub-Chunk
  152.  
  153.     This sub-chunk contains the filename (including any path the user
  154.     may have specified) of the image to be used as a reflection map
  155.     for the current surface.  Once again, if the length of the string
  156.     (including the terminating null) is odd, another null is added.
  157.     If the last part of the string is " (sequence)", then the first
  158.     part of the string specifies the prefix of an image sequence (the
  159.     actual filename in this case is generated by appending a three
  160.     digit frame number to the prefix when loading the image file for
  161.     each frame).  If the reflection setting in the REFL sub-chunk is
  162.     non-zero but no RIMG sub-chunk is present, then the surface is
  163.     assumed to reflect the sky and ground backdrop (or to use ray
  164.     traced reflection if ray tracing is enabled).
  165.  
  166.   RSAN Sub-Chunk
  167.  
  168.     This sub-chunk contains a four byte IEEE floating point number
  169.     that specifies the heading angle of the reflection map seam
  170.     (expressed in degrees).  This is new for LW 3.0.
  171.  
  172.   RIND Sub-Chunk
  173.  
  174.     This sub-chunk contains a four byte IEEE floating point number
  175.     that specifies the current surface's refractive index, which is
  176.     defined as the ratio of the speed of light in a vacuum to the
  177.     speed of light in the material.  Since light is fastest in a
  178.     vacuum, this value should therefore be greater than or equal to
  179.     1.0.
  180.  
  181.   EDGE Sub-Chunk
  182.  
  183.     This sub-chunk contains a four byte IEEE floating point number
  184.     that specifies the edge transparency threshold of the current
  185.     surface.  This value should lie between 0.0 and 1.0.
  186.  
  187.   SMAN Sub-Chunk
  188.  
  189.     This sub-chunk contains a four byte IEEE floating point number
  190.     that specifies the maximum angle between two adjacent polygons
  191.     that can be smooth shaded (expressed in degrees).  Polygons with
  192.     a greater angle between them will appear to meet at a sharp seam.
  193.     This is new for LW 3.0.
  194.  
  195.   CTEX, DTEX, STEX, RTEX, TTEX, and BTEX Sub-Chunks
  196.  
  197.     The presence of one of these sub-chunks indicates that the
  198.     current surface has a color, diffuse, specular, reflection,
  199.     transparency, or bump texture.  The contents of the sub-chunk is
  200.     a character string (terminated by one or two nulls as usual)
  201.     specifying the texture type as shown on the control panel.  Once
  202.     one of these sub-chunks is encountered within a SURF chunk, all
  203.     subsequent texture-related sub-chunks (those described below) are
  204.     considered to pertain to the current texture, until another CTEX,
  205.     DTEX, STEX, RTEX, TTEX, or BTEX sub-chunk is read.  Currently
  206.     there may be zero or one of each of these sub-chunks (up to six
  207.     textures) in each SURF chunk.
  208.  
  209.   TIMG Sub-Chunk
  210.  
  211.     This sub-chunk specifies the filename of the image (or the prefix
  212.     of the image sequence) to be used for image texture mapping.  See
  213.     the description of the RIMG sub-chunk above for more details.
  214.  
  215.   TFLG Sub-Chunk
  216.  
  217.     This sub-chunk contains a short integer whose bits specify
  218.     various options for the current texture.  Currently only the
  219.     seven least significant bits are used.  The options that set bits
  220.     indicate are (starting with the least significant bit):  X Axis,
  221.     Y Axis, Z Axis, World Coords, Negative Image, Pixel Blending, and
  222.     Antialiasing.  Note that only one of the three axis bits should
  223.     be set.
  224.  
  225.   TSIZ, TCTR, TFAL, and TVEL Sub-Chunks
  226.  
  227.     These sub-chunks each consist of three IEEE four byte floating
  228.     point numbers that specify the X, Y, and Z components of the
  229.     current texture's size, center, falloff, or velocity.  The TCTR,
  230.     TFAL, and TVEL sub-chunks are only needed if the corresponding
  231.     parameters are non-zero.
  232.  
  233.   TCLR Sub-Chunk
  234.  
  235.     This sub-chunk contains four bytes that specify the texture color
  236.     for the current texture, which should be of the color-modifying
  237.     variety (in other words, there should be a CTEX sub-chunk
  238.     somewhere before this sub-chunk).  The bytes are interpreted as
  239.     described above in the COLR sub-chunk section.
  240.  
  241.   TVAL Sub-Chunk
  242.  
  243.     This sub-chunk contains a short integer that specifies the
  244.     texture value of a diffuse, specular, reflection, or transparency
  245.     texture, so it should appear somewhere after a DTEX, STEX, RTEX,
  246.     or TTEX sub-chunk.  A value of 256 in the file corresponds to a
  247.     a setting of 100% on the control panel.
  248.  
  249.   TAMP Sub-Chunk
  250.  
  251.     This sub-chunk contains a four byte IEEE floating point number
  252.     that specifies the amplitude of the current bump texture, so it
  253.     should appear somewhere after a BTEX sub-chunk.  A value of 1.0
  254.     is equivalent to a setting of 100% on the control panel.
  255.  
  256.   TFRQ Sub-Chunk
  257.  
  258.     This sub-chunk contains a short integer that specifies the number
  259.     of noise frequencies or wave sources used by the current texture.
  260.  
  261.   TSP0, TSP1, and TSP2 Sub-Chunks
  262.  
  263.     These sub-chunks each contain a four byte IEEE floating point
  264.     number that specifies one of the special texture type-specific
  265.     parameters (such as Contrast, Turbulence, Wavelength, etc).
  266.     Which sub-chunk is used to record a particular parameter depends
  267.     on the order in which that parameter's button appears on the
  268.     control panel.  In the future there may be more than three of
  269.     these per texture.
  270.  
  271.  
  272. Object File Example
  273.  
  274.   A simple object (with somewhat complex surfaces) is listed below to
  275.   illustrate some of the features of a FORM LWOB.  The object is an
  276.   image-mapped bumpy square polygon in the XY plane with a shiny
  277.   transparent yellow triangle as a detail polygon.  Each line of the
  278.   listing shows 16 bytes in hexadecimal form followed by their ASCII
  279.   equivalents.  The notes under each line should be read from left to
  280.   right rather than top to bottom.
  281.  
  282.   464F524D 0000019C 4C574F42 504E5453    FORM....LWOBPNTS
  283.   00000054 3F800000 3F800000 00000000    ...T?...?.......
  284.            ^^^^^^^^ ^^^^^^^^ ^^^^^^^^
  285.            The X, Y, and Z coordinates of point number zero are 1.0,
  286.            1.0, and 0.0 (in IEEE format).
  287.       ^^^^
  288.       There are 84 bytes in the PNTS chunk, so there are seven points
  289.       in the object.
  290.  
  291.   BF800000 3F800000 00000000 3F800000    ....?.......?...
  292.   BF800000 00000000 BF800000 BF800000    ................
  293.   00000000 3F000000 BF000000 00000000    ....?...........
  294.   00000000 3F000000 00000000 BF000000    ....?...........
  295.   BF000000 00000000 53524653 00000012    ........SRFS....
  296.   53717561 72650000 54726961 6E676C65    Square..Triangle
  297.                ^^^^
  298.                The surface name "Square" is terminated with two nulls
  299.                to even out the number of bytes.
  300.  
  301.   0000504F 4C530000 00180004 00010000    ..POLS..........
  302.                         ^^^^
  303.                         The first polygon has four vertices (which
  304.                         are points 1, 0, 2, and 3).
  305.  
  306.   00020003 FFFF0001 00030005 00040006    ................
  307.                     ^^^^
  308.                     The detail polygon has three vertices (which are
  309.                     points 5, 4, and 6).
  310.                ^^^^
  311.                One detail polygon follows.
  312.            ^^^^
  313.            The first polygon's surface code is -1, so it uses surface
  314.            number one ("Square") and has detail polygons.
  315.  
  316.   00025355 52460000 00AE5371 75617265    ..SURF....Square
  317.       ^^^^ ^^^^
  318.       This begins the description of the surface called "Square".
  319.   ^^^^
  320.   The detail polygon uses surface number two ("Triangle").
  321.  
  322.   0000434F 4C520004 C8C8C800 464C4147    ..COLR......FLAG
  323.   00020000 44494646 00020100 43544558    ....DIFF....CTEX
  324.                              ^^^^^^^^
  325.                              The next set of texture sub-chunks
  326.                              pertain to the surface's color texture.
  327.                         ^^^^
  328.                         The "Square" surface's diffuse setting is
  329.                         100% (256 out of 256).
  330.  
  331.   0012506C 616E6172 20496D61 6765204D    ..Planar Image M
  332.       ^^^^ ^^^^^^^^ ^^^^^^^^ ^^^^^^^^
  333.       The color texture is planar mapping of the image in the IFF
  334.       file "RAM:Laura".
  335.  
  336.   61700000 54494D47 000A5241 4D3A4C61    ap..TIMG..RAM:La
  337.   75726100 54464C47 00020004 5453495A    ura.TFLG....TSIZ
  338.                         ^^^^
  339.                         The flag bits indicate that the image is to
  340.                         be projected along the Z axis.
  341.  
  342.   000C4000 00003FC0 00003F80 00005443    ..@...?...?...TC
  343.       ^^^^ ^^^^^^^^ ^^^^^^^^ ^^^^
  344.       The X, Y, and Z texture sizes are 2.0, 1.5, and 1.0.
  345.  
  346.   4C520004 00000000 42544558 000E4672    LR......BTEX..Fr
  347.                     ^^^^^^^^
  348.                     The next set of texture sub-chunks pertain to the
  349.                     "Square" surface's bump texture.
  350.  
  351.   61637461 6C204275 6D707300 54464C47    actal Bumps.TFLG
  352.   0002000A 5453495A 000C3DCC CCCD3DCC    ....TSIZ..=...=.
  353.       ^^^^
  354.       The flag bits indicate that "Worlds Coords" is turned on.
  355.  
  356.   CCCD3DCC CCCD5441 4D500004 3FC00000    ..=...TAMP..?...
  357.                              ^^^^^^^^
  358.                              The amplitude of the bumps is 150% (1.5
  359.                              in IEEE format).
  360.  
  361.   54465251 00020001 53555246 00000044    TFRQ....SURF...D
  362.                     ^^^^^^^^
  363.                     This begins the description of the surface called
  364.                     "Triangle".
  365.                ^^^^
  366.                The bump texture uses one frequency of noise.
  367.  
  368.   54726961 6E676C65 0000434F 4C520004    Triangle..COLR..
  369.   F0B40000 464C4147 00020000 44494646    ....FLAG....DIFF
  370.   ^^^^^^^^
  371.   The "Triangle" surface's color is yellow (240 red, 180 green, and 0
  372.   blue).
  373.  
  374.   0002009A 53504543 000200CD 474C4F53    ....SPEC....GLOS
  375.                         ^^^^
  376.                         The surface's specular setting is 80 % (205
  377.                         out of 256).
  378.  
  379.   00020100 5245464C 00020033 5452414E    ....REFL...3TRAN
  380.                         ^^^^
  381.                         The surface's reflection map setting is 20%
  382.                         (51 out of 256), but there is no RIMG sub-
  383.                         chunk, so the surface reflects the backdrop.
  384.       ^^^^
  385.       The surface has a high glossiness (256).
  386.  
  387.   00020066                               ...f
  388.       ^^^^
  389.       The surface is 40% transparent (102 out of 256).
  390.  
  391.   The "Triangle" surface has no textures, and there are no more
  392.   surfaces to be defined, so the object file ends here.
  393.  
  394.  
  395.  
  396. -- 
  397. {  Chris Hurtt   |     - Independant Avante-Guarde Animator/Filmmaker -      }
  398. {  Boulder, CO   | "The turn of the road all night went down the lift up     }
  399. { (303)-466-0150 |  from the back blue toad you so. It was then that it is." }
  400.             http://gwha.com/services/pixelkit/people/chris/chris.html